package org.semanticflash.rdf.values
{
	
	



	/**
	 * 
	 * A literal with a language tag
	 * 
	 * @author aldo.bucchi@gmail.com
	 * 
	 */
	public class RDFLangLiteral extends RDFLiteral
	{
		
		private var _languageTag:String;
		public function get languageTag():String
		{
			return _languageTag;
		}


		public function RDFLangLiteral( lexicalValue:String, languageTag:String )
		{
			super( lexicalValue );
			_languageTag = languageTag;
		}
		
		
		
		
		// cache for performance
		private var _nt:String;
		
		override public function get nt():String
		{
			if ( !_nt )
				_nt = super.nt + "@" + this.languageTag;
			return _nt;
		}
		
		
		
		
		
		
		
		
		public static function instance( lexicalValue:String, languageTag:String ):RDFLangLiteral
		{
			
			var key:String, cachedTerm:RDFValue;			
			
			key = "l_" + hash( languageTag + " " + lexicalValue );
			
			cachedTerm = getCachedValue( key );
			if ( cachedTerm )
				return cachedTerm  as RDFLangLiteral;

			return cacheValue( key, new RDFLangLiteral( lexicalValue, languageTag ) ) as RDFLangLiteral;
		}

		
		
		
		
		
		
		
		
				

	}


}